<!doctype html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport"
        content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>js循环结构之while</title>
</head>
<body>
  <script>
    function table(options = { tr: 5, td: 4 }) {
      document.write('<table border="1" width="100%">')
      while (options.tr--) {
        document.write('<tr>')
        let td = options.td
        while (td--) {
          document.write(`<td>${td}</td>`)
        }
        document.write('</tr>')
      }
      document.write('</table>')
    }
    table()
    table({ tr: 10, td: 8 })
  </script>
</body>
</html>